package com.ruoyi.xysl.mapper;

import com.xysl.api.domain.XyslRole;
import com.ruoyi.xysl.domain.dto.XyslUserDto;
import com.xysl.api.domain.XyslUser;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 角色Mapper接口
 *
 * @author xysl
 * @date 2025-01-10
 */
public interface SysXyslRoleMapper
{
    /**
     * 查询角色
     *
     * @param id 角色主键
     * @return 角色
     */
    public XyslRole selectXyslRoleById(Long id);

    /**
     * 查询角色列表
     *
     * @param xyslRole 角色
     * @return 角色集合
     */
    public List<XyslRole> selectXyslRoleList(XyslRole xyslRole);

    /**
     * 新增角色
     *
     * @param xyslRole 角色
     * @return 结果
     */
    public int insertXyslRole(XyslRole xyslRole);

    /**
     * 修改角色
     *
     * @param xyslRole 角色
     * @return 结果
     */
    public int updateXyslRole(XyslRole xyslRole);

    /**
     * 删除角色
     *
     * @param id 角色主键
     * @return 结果
     */
    public int deleteXyslRoleById(Long id);

    /**
     * 批量删除角色
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteXyslRoleByIds(Long[] ids);

    XyslRole checkRoleNameUnique(String roleName);

    XyslRole checkRoleCodeUnique(String roleCode);

    void deleteRoleMenuByRoleId(Long id);

    int batchRoleMenu(List<Map<String, Object>> list);

    int batchUserRole(List<Map<String, Object>> list);

    List<XyslUser> selectAllocatedList(XyslUserDto user);

    List<XyslUser> selectUnallocatedList(XyslUserDto user);

    public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);

    void deleteRoleMenu(Long[] roleIds);

    int countUserRoleByRoleId(Long roleId);

    List<XyslRole> selectParentRoleList(Long roleId);
}
